from selenium import webdriver
from spider_h5.seleinum_bankend.service.applet_page_service import AppletPageService

"""
Description:
Page页面主要是加载页面之间的表现层，包括任何的数据交互和页面操作
"""


class AppletPage(object):
    def __init__(self, client):
        self.client = client
        self.browser: webdriver = client.browser
        self.name = 'appletdata'

    def save_all_applet(self):
        """
        保存所有的小程序信息
        """
        AppletPageService(self.client, self.name).save_applet_info()

    def clear_all_applet(self):
        """
        清除所有的小程序信息
        """
        AppletPageService(self.client, self.name).clear_collection()

    def enter_applet_id(self, applet_id):
        """
        根据ID进入小程序
        Params:
        -applet_id:小程序ID
        """
        AppletPageService(self.client, self.name).enter_applet_id(applet_id)
